﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/UserHome.Master" CodeBehind="Search.aspx.vb" Inherits="LEAD.Search" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <tr>
<td>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<table style=" text-align:center; ">
<tr  align="center">
<td align="center">
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1"
                runat="server" Text="Search" />
                </td>
                </tr>
                <tr align="center"><td align="center">
            <br />
                <asp:TextBoxWatermarkExtender id="TextBoxWatermarkExtender1" runat="server" TargetControlID="TextBox1"
     WatermarkText="Search from Title" WatermarkCssClass="WaterMarkedTextBox" />
                    <asp:Panel ID="Panel1" Visible="false" runat="server">
                   
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                DataSourceID="SqlDataSource1">
                <Columns>
           <asp:BoundField DataField="TypeName" HeaderText="TypeName" 
            SortExpression="TypeName" />
    <asp:HyperLinkField DataNavigateUrlFields="ActionID" 
            DataNavigateUrlFormatString="Details.aspx?ActionID={0}" 
            DataTextField="Title" HeaderText="Title" 
            SortExpression="Title" >
            <ControlStyle Width="200px" />
            <HeaderStyle Width="200px" />
            <ItemStyle HorizontalAlign="Center" />
        </asp:HyperLinkField>
        <asp:BoundField DataField="AddedDate" HeaderText="AddedDate" 
            SortExpression="AddedDate" />
        <asp:BoundField DataField="UserName" HeaderText="UserName" 
            SortExpression="UserName" />
          <asp:BoundField DataField="Count_page" HeaderText="Visits" 
            SortExpression="Count_page" />
                                
        <asp:ImageField DataImageUrlField="Image" HeaderText="Image">
            <ControlStyle CssClass="rssthumbimg" Width="50px" />
            <HeaderStyle Width="50px" />
            <ItemStyle HorizontalAlign="Center" />
        </asp:ImageField>
                </Columns>
                <EmptyDataTemplate>
                No data found! Try keying different text.
                </EmptyDataTemplate>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                SelectCommand="SELECT MasterTable.ActionID, aspnet_Users.UserName, MasterTable.Count_page, Type.TypeName, MasterTable.Title, MasterTable.Image, MasterTable.AddedDate
FROM aspnet_Users INNER JOIN (Type INNER JOIN MasterTable ON Type.[TypeID] = MasterTable.[TypeID_FK]) ON aspnet_Users.[UserID] = MasterTable.[UserID_FK] WHERE (MasterTable.[Title] LIKE '%' + ? + '%') OR (MasterTable.[Description] LIKE '%' + ? + '%')">
                <SelectParameters>
                    <asp:ControlParameter ControlID="TextBox1" Name="Title" PropertyName="Text" 
                        Type="String" />
                    <asp:ControlParameter ControlID="TextBox1" Name="Description" PropertyName="Text" 
                        Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>

      </asp:Panel>
</td>
</tr>
</table>
</form>
</td>
</tr>
</asp:Content>
